package com.homework.controller;

import com.homework.entity.Passport;
import com.homework.service.PassportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pass")
@Slf4j
public class PassportController {

    @Autowired
    private PassportService passportService;

    @GetMapping("/{id}")
    public void getPassportAndPassengers(@PathVariable int id){
        Passport passport = passportService.getPassportAndPassengers(id);
        log.info("passport:{}",passport);
    }

    @GetMapping("/2/{id}")
    public void getPassportAndPassengers2(@PathVariable int id){
        Passport passport = passportService.getPassportAndPassengers2(id);
        log.info("passport:{}",passport);
    }
}
